package com.bt.mapper;

import com.bt.annotation.AutoFill;
import com.bt.dto.YddArticleListDTO;
import com.bt.dto.YddUserNewDTO;
import com.bt.entity.YddArticle;
import com.bt.vo.YddArticlePageVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description TODO
 * @Author 青
 * @Date 2023-04-30 0:51
 */
@Mapper
public interface YddArticleMapper {
    /**
     * 查询出阅读排名前6的数据
     *
     * @return
     */
    @Select("SELECT id, title, author, click,keywords FROM ydd_article\n" +
            "WHERE status = 2   " +
            "ORDER BY click DESC " +
            "LIMIT 7;")
    List<YddArticle> countHotArticle();

    /**
     * 文章列表分页查询
     * @param yddArticleListDTO
     * @return
     */
    Page<YddArticlePageVO> page(YddArticleListDTO yddArticleListDTO);

    void deleteById(Integer id);

    /**
     * 文章添加
     *
     * @param yddArticle
     */
    void insert(YddArticle yddArticle);

    /**
     * 根据id查看文章详情(数据回显)
     *
     * @param id
     * @return
     */
    YddArticle findByid(String id);

    /**
     * 文章修改
     *
     * @param yddArticle
     */

    void update(YddArticle yddArticle);


}
